package com.yeraphael.mapper;

import com.yeraphael.entity.Emp;
import com.yeraphael.entity.EmpQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {
////    统计员工记录数
//    @Select("select count(*) from emp")
//    Long total();
//
////    查询每页记录
//    @Select("select e.*, d.name deptName from emp e left join dept d on e.dept_id = d.id limit #{start},#{pageSize}")
//    List<Emp> rows(Integer start, Integer pageSize);

//    分页查询
//    @Select("select e.*, d.name deptName from emp e left join dept d on e.dept_id = d.id")
//    使用动态XML
    List<Emp> list(EmpQueryParam param);

//    @Options(useGeneratedKeys = true, keyProperty = "id")
//    @Insert("insert into emp values (null,#{username},#{password},#{name},#{gender}," +
//            "#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void saveEmp(Emp emp);

    void deleteBatch(List<Integer> ids);

    Emp getEmp(Integer id);


    void updateEmp(Emp emp);

    @Select("select id,username, password, name, gender, phone, job, salary, image, entry_date, dept_id, create_time,update_time from emp;")
    List<Emp> getListCl();
}
